<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <div th:include="base-libs :: base-libs" />
    <title>双向转诊台账—修改</title>

    <style>
        .laydate_box{
            top:0 !important;
        }
        .laydate-icon{
            border:1px solid #B6B6B6;
            height:28px;
            width:88% !important;
        }
    </style>
    <script>
        $(function(){
            initView();
            initData();
        })

        function initView(){
            $("input").css("paddingLeft","3px");
            enterToQuery(function(){
                $("#btnTj").trigger("click");
            });

            //履约时间laydate时间空间超界处理
            $("[name=LYSJ]").click(function(){
                $("#laydate_box").css({"left":"auto","right":"0px"});
            })

            //是否履约与履约时间--联动
            $("[name=SFLY]").change(function(){
                var sflyVal = $(this).val();
                if(sflyVal == 1){ //是
                    $("[name=LYSJ]").addClass("form-control");
                }else{
                    $("[name=LYSJ]").removeClass("form-control");
                }
            })

            /** 确定修改 */
            $("#btnTj").click(function(){
                if($(".form-control").QuickValidate()){
                    $.QuickRemote.AjaxFiledFormSubmit("formTj", function(result){
                        if(result.state){
                            $.QuickAlert.alertNormal(result.info, {callback: function(){
                                StoreCache.setCache("refresh",true);
                                $("#btnQx").trigger("click");
                            }});
                        }else{
                            $.QuickAlert.alertFail({content: result.info});
                        }
                    }, {type:'update'});
                }
            })

            /** 取消修改 */
            $("#btnQx").click(function(){
                parent.layer.closeAll();
            })

        }

        function initData(){
            var sxzztzData = StoreCache.removeCache("sxzztzData");
            if(!$.isEmptyObject(sxzztzData)){
                if(sxzztzData.ZZBS == 1){ //转诊标识：1：转出；2：转入
                    $("table:eq(1)").remove();
                }else{
                    $("table:eq(0)").remove();
                }
                //删除table后再载入值域，可以避免必选必填项出现2个红星
                $(this).registerManagerPage({callback:function(){
                    var timeReg = /^(\d{4}-\d{2}-\d{2})\s+\d{2}:\d{2}:\d{2}/;
                    $(".form-control").each(function(){
                        var key = $(this).attr("name");
                        $(this).val(sxzztzData[key].replace(timeReg, "$1"));
                    })
                    $("[name=SFLY]").trigger("change");
                    $("body").css("visibility","visible");
                }});
            }else{
                $.QuickAlert.alertFail({content: "数据丢失，请重新进入!"});
            }
        }
    </script>
</head>
<body class="easyui-layout" style="visibility: hidden" border="false">
    <div region="center" border="false">
        <form action="save" id="formTj">
            <!--
                双向转诊——转出修改
            -->
            <table class="form-table" style="margin-top:10px;">
                <tr>
                    <td class="td-text" style="width:15%"><label>申请转诊时间：</label></td>
                    <td class="td-content">
                        <input name="ID" class="form-control" readonly hidden type="hidden"/>
                        <input name="FQZZSJ" class="form-control laydate-icon" readonly
                        quick-config="label:'申请转诊时间', validateProxy:'notNull'" onclick="laydate()"/>
                    </td>
                    <td class="td-text"><label>患者姓名：</label></td>
                    <td class="td-content">
                        <input name="XM" class="form-control"  style="width: 100%;"
                               quick-config="label:'患者姓名', validateProxy:'notNull length',length:'32'"/>
                    </td>
                    <td class="td-text"><label>证件号码：</label></td>
                    <td class="td-content">
                        <input name="SFZH" class="form-control"  style="width: 100%;"
                        quick-config="label:'证件号码', validateProxy:'notNull idCard length', length: '32'"/>
                    </td>
                </tr>
                <tr>
                    <td class="td-text"><label>转入医院：</label></td>
                    <td class="td-content">
                        <input name="ZRYY" class="form-control" style="width: 100%;"
                               quick-config="label:'转入医院', validateProxy:'notNull length', length: '128'" />
                    </td>
                    <td class="td-text"><label>转入科室：</label></td>
                    <td class="td-content">
                        <input name="ZRKS" class="form-control" style="width: 100%;"
                               quick-config="label:'转入科室', validateProxy:'notNull length', length: '128'"/>
                    </td>
                    <td class="td-text"><label>转诊类型：</label></td>
                    <td class="td-content">
                        <select name="ZZLX" class="form-control condition" style="width: 100%;" cacheTable="TB_ZY_ZZLX"
                            quick-config="label:'转诊类型', validateProxy:'notNull'">
                        </select>
                    </td>

                </tr>
                <tr>
                    <td class="td-text"><label>紧急程度：</label></td>
                    <td class="td-content">
                        <select name="JJCD" class="form-control condition" style="width: 100%;" cacheTable="TB_ZY_JJCD"
                            quick-config="label:'紧急程度', validateProxy:'notNull'">
                        </select>
                    </td>
                    <td class="td-text"><label>是否履约：</label></td>
                    <td class="td-content">
                        <select name="SFLY" class="form-control condition" style="width: 100%;"
                            quick-config="label:'是否履约', validateProxy:'notNull'">
                            <option value="">请选择</option>
                            <option value="1">已履约</option>
                            <option value="2">未履约</option>
                        </select>
                    </td>
                    <td class="td-text"><label>履约时间：</label></td>
                    <td class="td-content">
                        <input name="LYSJ" class="form-control laydate-icon" readonly  onclick="laydate()"
                               quick-config="label:'履约时间', validateProxy:'notNull'"/>
                    </td>
                </tr>
                <tr>
                    <td class="td-text"><label>是否签约：</label></td>
                    <td class="td-content">
                        <select name="SFQY" class="form-control condition" style="width: 100%;"
                            quick-config="label:'是否签约', validateProxy:'notNull'">
                            <option value="">请选择</option>
                            <option value="1">已签约</option>
                            <option value="2">未签约</option>
                        </select>
                    </td>
                </tr>
            </table>

            <!--
                双向转诊——转入修改
            -->
            <table class="form-table" style="margin-top:10px;">
                <tr>
                    <td class="td-text" style="width:15%"><label>申请转诊时间：</label></td>
                    <td class="td-content">
                        <input name="ID" class="form-control" readonly hidden type="hidden"/>
                        <input name="ZZYYSJ" class="form-control laydate-icon" readonly
                               quick-config="label:'申请转诊时间', validateProxy:'notNull'" onclick="laydate()"/>
                    </td>
                    <td class="td-text"><label>患者姓名：</label></td>
                    <td class="td-content">
                        <input name="XM" class="form-control"  style="width: 100%;"
                        quick-config="label:'患者姓名', validateProxy:'notNull length', length: '32'">
                    </td>
                    <td class="td-text"><label>证件号码：</label></td>
                    <td class="td-content">
                        <input name="SFZH" class="form-control"  style="width: 100%;"
                               quick-config="label:'证件号码', validateProxy:'notNull idCard length', length: '32'"/>
                    </td>
                </tr>
                <tr>
                    <td class="td-text"><label>转出医院：</label></td>
                    <td class="td-content">
                        <input name="ZCYY" class="form-control" style="width: 100%;"
                               quick-config="label:'手机号码', validateProxy:'notNull length', length: '128'" />
                    </td>
                    <td class="td-text"><label>转出科室：</label></td>
                    <td class="td-content">
                        <input name="ZCKS" class="form-control" style="width: 100%;"
                               quick-config="label:'转出科室', validateProxy:'notNull length', length: '128'"/>
                    </td>
                    <td class="td-text"><label>转诊类型：</label></td>
                    <td class="td-content">
                        <select name="ZZLX" class="form-control condition" style="width: 100%;" cacheTable="TB_ZY_ZZLX"
                                quick-config="label:'转诊类型', validateProxy:'notNull'">
                        </select>
                    </td>

                </tr>
                <tr>
                    <td class="td-text"><label>紧急程度：</label></td>
                    <td class="td-content">
                        <select name="JJCD" class="form-control condition" style="width: 100%;" cacheTable="TB_ZY_JJCD"
                                quick-config="label:'紧急程度', validateProxy:'notNull'">
                        </select>
                    </td>
                    <td class="td-text"><label>是否履约：</label></td>
                    <td class="td-content">
                        <select name="SFLY" class="form-control condition" style="width: 100%;"
                                quick-config="label:'是否履约', validateProxy:'notNull'">
                            <option value="">请选择</option>
                            <option value="1">已履约</option>
                            <option value="2">未履约</option>
                        </select>
                    </td>
                    <td class="td-text"><label>履约时间：</label></td>
                    <td class="td-content">
                        <input name="LYSJ" class="form-control laydate-icon" readonly  onclick="laydate()"
                        quick-config="label:'履约时间', validateProxy:'notNull'"/>
                    </td>
                </tr>
                <tr>
                    <td class="td-text"><label>是否签约：</label></td>
                    <td class="td-content">
                        <select name="SFQY" class="form-control condition" style="width: 100%;"
                                quick-config="label:'是否签约', validateProxy:'notNull'">
                            <option value="">请选择</option>
                            <option value="1">已签约</option>
                            <option value="2">未签约</option>
                        </select>
                    </td>
                </tr>
            </table>
        </form>
    </div>
    <div region="south" style="height:40px;line-height:40px;border:0;border-top:1px solid #ddd;text-align: center;overflow: hidden">
        <button id="btnTj" class="btn btn-info" type="button">提交</button>
        <button id="btnQx" class="btn btn-info" type="button">取消</button>
    </div>
</body>
</html>